1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /**
18  * @addtogroup Input
19  * @{
20  */
21 
22 /**
23  * @file input.h
24  */
25 
26 module android.ndk.input;
27 
28 import arsd.jni;
29 import android.ndk;
30 
31 extern (C):
32 nothrow:
33 @nogc:
34 
35 /******************************************************************
36  *
37  * IMPORTANT NOTICE:
38  *
39  *   This file is part of Android's set of stable system headers
40  *   exposed by the Android NDK (Native Development Kit).
41  *
42  *   Third-party source AND binary code relies on the definitions
43  *   here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
44  *
45  *   - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
46  *   - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
47  *   - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
48  *   - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
49  */
50 
51 /*
52  * Structures and functions to receive and process input events in
53  * native code.
54  *
55  * NOTE: These functions MUST be implemented by /system/lib/libui.so
56  */
57 
58 /* nothing */
59 
60 /**
61  * Key states (may be returned by queries about the current state of a
62  * particular key code, scan code or switch).
63  */
64 enum
65 {
66     /** The key state is unknown or the requested key itself is not supported. */
67     AKEY_STATE_UNKNOWN = -1,
68 
69     /** The key is up. */
70     AKEY_STATE_UP = 0,
71 
72     /** The key is down. */
73     AKEY_STATE_DOWN = 1,
74 
75     /** The key is down but is a virtual key press that is being emulated by the system. */
76     AKEY_STATE_VIRTUAL = 2
77 }
78 
79 /**
80  * Meta key / modifier state.
81  */
82 enum
83 {
84     /** No meta keys are pressed. */
85     AMETA_NONE = 0,
86 
87     /** This mask is used to check whether one of the ALT meta keys is pressed. */
88     AMETA_ALT_ON = 0x02,
89 
90     /** This mask is used to check whether the left ALT meta key is pressed. */
91     AMETA_ALT_LEFT_ON = 0x10,
92 
93     /** This mask is used to check whether the right ALT meta key is pressed. */
94     AMETA_ALT_RIGHT_ON = 0x20,
95 
96     /** This mask is used to check whether one of the SHIFT meta keys is pressed. */
97     AMETA_SHIFT_ON = 0x01,
98 
99     /** This mask is used to check whether the left SHIFT meta key is pressed. */
100     AMETA_SHIFT_LEFT_ON = 0x40,
101 
102     /** This mask is used to check whether the right SHIFT meta key is pressed. */
103     AMETA_SHIFT_RIGHT_ON = 0x80,
104 
105     /** This mask is used to check whether the SYM meta key is pressed. */
106     AMETA_SYM_ON = 0x04,
107 
108     /** This mask is used to check whether the FUNCTION meta key is pressed. */
109     AMETA_FUNCTION_ON = 0x08,
110 
111     /** This mask is used to check whether one of the CTRL meta keys is pressed. */
112     AMETA_CTRL_ON = 0x1000,
113 
114     /** This mask is used to check whether the left CTRL meta key is pressed. */
115     AMETA_CTRL_LEFT_ON = 0x2000,
116 
117     /** This mask is used to check whether the right CTRL meta key is pressed. */
118     AMETA_CTRL_RIGHT_ON = 0x4000,
119 
120     /** This mask is used to check whether one of the META meta keys is pressed. */
121     AMETA_META_ON = 0x10000,
122 
123     /** This mask is used to check whether the left META meta key is pressed. */
124     AMETA_META_LEFT_ON = 0x20000,
125 
126     /** This mask is used to check whether the right META meta key is pressed. */
127     AMETA_META_RIGHT_ON = 0x40000,
128 
129     /** This mask is used to check whether the CAPS LOCK meta key is on. */
130     AMETA_CAPS_LOCK_ON = 0x100000,
131 
132     /** This mask is used to check whether the NUM LOCK meta key is on. */
133     AMETA_NUM_LOCK_ON = 0x200000,
134 
135     /** This mask is used to check whether the SCROLL LOCK meta key is on. */
136     AMETA_SCROLL_LOCK_ON = 0x400000
137 }
138 
139 struct AInputEvent;
140 /**
141  * Input events.
142  *
143  * Input events are opaque structures.  Use the provided accessors functions to
144  * read their properties.
145  */
146 
147 /**
148  * Input event types.
149  */
150 enum
151 {
152     /** Indicates that the input event is a key event. */
153     AINPUT_EVENT_TYPE_KEY = 1,
154 
155     /** Indicates that the input event is a motion event. */
156     AINPUT_EVENT_TYPE_MOTION = 2
157 }
158 
159 /**
160  * Key event actions.
161  */
162 enum
163 {
164     /** The key has been pressed down. */
165     AKEY_EVENT_ACTION_DOWN = 0,
166 
167     /** The key has been released. */
168     AKEY_EVENT_ACTION_UP = 1,
169 
170     /**
171      * Multiple duplicate key events have occurred in a row, or a
172      * complex string is being delivered.  The repeat_count property
173      * of the key event contains the number of times the given key
174      * code should be executed.
175      */
176     AKEY_EVENT_ACTION_MULTIPLE = 2
177 }
178 
179 /**
180  * Key event flags.
181  */
182 enum
183 {
184     /** This mask is set if the device woke because of this key event. */
185     AKEY_EVENT_FLAG_WOKE_HERE = 0x1,
186 
187     /** This mask is set if the key event was generated by a software keyboard. */
188     AKEY_EVENT_FLAG_SOFT_KEYBOARD = 0x2,
189 
190     /** This mask is set if we don't want the key event to cause us to leave touch mode. */
191     AKEY_EVENT_FLAG_KEEP_TOUCH_MODE = 0x4,
192 
193     /**
194      * This mask is set if an event was known to come from a trusted
195      * part of the system.  That is, the event is known to come from
196      * the user, and could not have been spoofed by a third party
197      * component.
198      */
199     AKEY_EVENT_FLAG_FROM_SYSTEM = 0x8,
200 
201     /**
202      * This mask is used for compatibility, to identify enter keys that are
203      * coming from an IME whose enter key has been auto-labelled "next" or
204      * "done".  This allows TextView to dispatch these as normal enter keys
205      * for old applications, but still do the appropriate action when
206      * receiving them.
207      */
208     AKEY_EVENT_FLAG_EDITOR_ACTION = 0x10,
209 
210     /**
211      * When associated with up key events, this indicates that the key press
212      * has been canceled.  Typically this is used with virtual touch screen
213      * keys, where the user can slide from the virtual key area on to the
214      * display: in that case, the application will receive a canceled up
215      * event and should not perform the action normally associated with the
216      * key.  Note that for this to work, the application can not perform an
217      * action for a key until it receives an up or the long press timeout has
218      * expired.
219      */
220     AKEY_EVENT_FLAG_CANCELED = 0x20,
221 
222     /**
223      * This key event was generated by a virtual (on-screen) hard key area.
224      * Typically this is an area of the touchscreen, outside of the regular
225      * display, dedicated to "hardware" buttons.
226      */
227     AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY = 0x40,
228 
229     /**
230      * This flag is set for the first key repeat that occurs after the
231      * long press timeout.
232      */
233     AKEY_EVENT_FLAG_LONG_PRESS = 0x80,
234 
235     /**
236      * Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long
237      * press action was executed while it was down.
238      */
239     AKEY_EVENT_FLAG_CANCELED_LONG_PRESS = 0x100,
240 
241     /**
242      * Set for AKEY_EVENT_ACTION_UP when this event's key code is still being
243      * tracked from its initial down.  That is, somebody requested that tracking
244      * started on the key down and a long press has not caused
245      * the tracking to be canceled.
246      */
247     AKEY_EVENT_FLAG_TRACKING = 0x200,
248 
249     /**
250      * Set when a key event has been synthesized to implement default behavior
251      * for an event that the application did not handle.
252      * Fallback key events are generated by unhandled trackball motions
253      * (to emulate a directional keypad) and by certain unhandled key presses
254      * that are declared in the key map (such as special function numeric keypad
255      * keys when numlock is off).
256      */
257     AKEY_EVENT_FLAG_FALLBACK = 0x400
258 }
259 
260 /**
261  * Bit shift for the action bits holding the pointer index as
262  * defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK.
263  */
264 enum AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT = 8;
265 
266 /** Motion event actions */
267 enum
268 {
269     /** Bit mask of the parts of the action code that are the action itself. */
270     AMOTION_EVENT_ACTION_MASK = 0xff,
271 
272     /**
273      * Bits in the action code that represent a pointer index, used with
274      * AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP.  Shifting
275      * down by AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer
276      * index where the data for the pointer going up or down can be found.
277      */
278     AMOTION_EVENT_ACTION_POINTER_INDEX_MASK = 0xff00,
279 
280     /** A pressed gesture has started, the motion contains the initial starting location. */
281     AMOTION_EVENT_ACTION_DOWN = 0,
282 
283     /**
284      * A pressed gesture has finished, the motion contains the final release location
285      * as well as any intermediate points since the last down or move event.
286      */
287     AMOTION_EVENT_ACTION_UP = 1,
288 
289     /**
290      * A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and
291      * AMOTION_EVENT_ACTION_UP).  The motion contains the most recent point, as well as
292      * any intermediate points since the last down or move event.
293      */
294     AMOTION_EVENT_ACTION_MOVE = 2,
295 
296     /**
297      * The current gesture has been aborted.
298      * You will not receive any more points in it.  You should treat this as
299      * an up event, but not perform any action that you normally would.
300      */
301     AMOTION_EVENT_ACTION_CANCEL = 3,
302 
303     /**
304      * A movement has happened outside of the normal bounds of the UI element.
305      * This does not provide a full gesture, but only the initial location of the movement/touch.
306      */
307     AMOTION_EVENT_ACTION_OUTSIDE = 4,
308 
309     /**
310      * A non-primary pointer has gone down.
311      * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
312      */
313     AMOTION_EVENT_ACTION_POINTER_DOWN = 5,
314 
315     /**
316      * A non-primary pointer has gone up.
317      * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
318      */
319     AMOTION_EVENT_ACTION_POINTER_UP = 6,
320 
321     /**
322      * A change happened but the pointer is not down (unlike AMOTION_EVENT_ACTION_MOVE).
323      * The motion contains the most recent point, as well as any intermediate points since
324      * the last hover move event.
325      */
326     AMOTION_EVENT_ACTION_HOVER_MOVE = 7,
327 
328     /**
329      * The motion event contains relative vertical and/or horizontal scroll offsets.
330      * Use getAxisValue to retrieve the information from AMOTION_EVENT_AXIS_VSCROLL
331      * and AMOTION_EVENT_AXIS_HSCROLL.
332      * The pointer may or may not be down when this event is dispatched.
333      * This action is always delivered to the winder under the pointer, which
334      * may not be the window currently touched.
335      */
336     AMOTION_EVENT_ACTION_SCROLL = 8,
337 
338     /** The pointer is not down but has entered the boundaries of a window or view. */
339     AMOTION_EVENT_ACTION_HOVER_ENTER = 9,
340 
341     /** The pointer is not down but has exited the boundaries of a window or view. */
342     AMOTION_EVENT_ACTION_HOVER_EXIT = 10,
343 
344     /* One or more buttons have been pressed. */
345     AMOTION_EVENT_ACTION_BUTTON_PRESS = 11,
346 
347     /* One or more buttons have been released. */
348     AMOTION_EVENT_ACTION_BUTTON_RELEASE = 12
349 }
350 
351 /**
352  * Motion event flags.
353  */
354 enum
355 {
356     /**
357      * This flag indicates that the window that received this motion event is partly
358      * or wholly obscured by another visible window above it.  This flag is set to true
359      * even if the event did not directly pass through the obscured area.
360      * A security sensitive application can check this flag to identify situations in which
361      * a malicious application may have covered up part of its content for the purpose
362      * of misleading the user or hijacking touches.  An appropriate response might be
363      * to drop the suspect touches or to take additional precautions to confirm the user's
364      * actual intent.
365      */
366     AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 0x1
367 }
368 
369 /**
370  * Motion event edge touch flags.
371  */
372 enum
373 {
374     /** No edges intersected. */
375     AMOTION_EVENT_EDGE_FLAG_NONE = 0,
376 
377     /** Flag indicating the motion event intersected the top edge of the screen. */
378     AMOTION_EVENT_EDGE_FLAG_TOP = 0x01,
379 
380     /** Flag indicating the motion event intersected the bottom edge of the screen. */
381     AMOTION_EVENT_EDGE_FLAG_BOTTOM = 0x02,
382 
383     /** Flag indicating the motion event intersected the left edge of the screen. */
384     AMOTION_EVENT_EDGE_FLAG_LEFT = 0x04,
385 
386     /** Flag indicating the motion event intersected the right edge of the screen. */
387     AMOTION_EVENT_EDGE_FLAG_RIGHT = 0x08
388 }
389 
390 /**
391  * Constants that identify each individual axis of a motion event.
392  * @anchor AMOTION_EVENT_AXIS
393  */
394 enum
395 {
396     /**
397      * Axis constant: X axis of a motion event.
398      *
399      * - For a touch screen, reports the absolute X screen position of the center of
400      * the touch contact area.  The units are display pixels.
401      * - For a touch pad, reports the absolute X surface position of the center of the touch
402      * contact area. The units are device-dependent.
403      * - For a mouse, reports the absolute X screen position of the mouse pointer.
404      * The units are display pixels.
405      * - For a trackball, reports the relative horizontal displacement of the trackball.
406      * The value is normalized to a range from -1.0 (left) to 1.0 (right).
407      * - For a joystick, reports the absolute X position of the joystick.
408      * The value is normalized to a range from -1.0 (left) to 1.0 (right).
409      */
410     AMOTION_EVENT_AXIS_X = 0,
411     /**
412      * Axis constant: Y axis of a motion event.
413      *
414      * - For a touch screen, reports the absolute Y screen position of the center of
415      * the touch contact area.  The units are display pixels.
416      * - For a touch pad, reports the absolute Y surface position of the center of the touch
417      * contact area. The units are device-dependent.
418      * - For a mouse, reports the absolute Y screen position of the mouse pointer.
419      * The units are display pixels.
420      * - For a trackball, reports the relative vertical displacement of the trackball.
421      * The value is normalized to a range from -1.0 (up) to 1.0 (down).
422      * - For a joystick, reports the absolute Y position of the joystick.
423      * The value is normalized to a range from -1.0 (up or far) to 1.0 (down or near).
424      */
425     AMOTION_EVENT_AXIS_Y = 1,
426     /**
427      * Axis constant: Pressure axis of a motion event.
428      *
429      * - For a touch screen or touch pad, reports the approximate pressure applied to the surface
430      * by a finger or other tool.  The value is normalized to a range from
431      * 0 (no pressure at all) to 1 (normal pressure), although values higher than 1
432      * may be generated depending on the calibration of the input device.
433      * - For a trackball, the value is set to 1 if the trackball button is pressed
434      * or 0 otherwise.
435      * - For a mouse, the value is set to 1 if the primary mouse button is pressed
436      * or 0 otherwise.
437      */
438     AMOTION_EVENT_AXIS_PRESSURE = 2,
439     /**
440      * Axis constant: Size axis of a motion event.
441      *
442      * - For a touch screen or touch pad, reports the approximate size of the contact area in
443      * relation to the maximum detectable size for the device.  The value is normalized
444      * to a range from 0 (smallest detectable size) to 1 (largest detectable size),
445      * although it is not a linear scale. This value is of limited use.
446      * To obtain calibrated size information, see
447      * {@link AMOTION_EVENT_AXIS_TOUCH_MAJOR} or {@link AMOTION_EVENT_AXIS_TOOL_MAJOR}.
448      */
449     AMOTION_EVENT_AXIS_SIZE = 3,
450     /**
451      * Axis constant: TouchMajor axis of a motion event.
452      *
453      * - For a touch screen, reports the length of the major axis of an ellipse that
454      * represents the touch area at the point of contact.
455      * The units are display pixels.
456      * - For a touch pad, reports the length of the major axis of an ellipse that
457      * represents the touch area at the point of contact.
458      * The units are device-dependent.
459      */
460     AMOTION_EVENT_AXIS_TOUCH_MAJOR = 4,
461     /**
462      * Axis constant: TouchMinor axis of a motion event.
463      *
464      * - For a touch screen, reports the length of the minor axis of an ellipse that
465      * represents the touch area at the point of contact.
466      * The units are display pixels.
467      * - For a touch pad, reports the length of the minor axis of an ellipse that
468      * represents the touch area at the point of contact.
469      * The units are device-dependent.
470      *
471      * When the touch is circular, the major and minor axis lengths will be equal to one another.
472      */
473     AMOTION_EVENT_AXIS_TOUCH_MINOR = 5,
474     /**
475      * Axis constant: ToolMajor axis of a motion event.
476      *
477      * - For a touch screen, reports the length of the major axis of an ellipse that
478      * represents the size of the approaching finger or tool used to make contact.
479      * - For a touch pad, reports the length of the major axis of an ellipse that
480      * represents the size of the approaching finger or tool used to make contact.
481      * The units are device-dependent.
482      *
483      * When the touch is circular, the major and minor axis lengths will be equal to one another.
484      *
485      * The tool size may be larger than the touch size since the tool may not be fully
486      * in contact with the touch sensor.
487      */
488     AMOTION_EVENT_AXIS_TOOL_MAJOR = 6,
489     /**
490      * Axis constant: ToolMinor axis of a motion event.
491      *
492      * - For a touch screen, reports the length of the minor axis of an ellipse that
493      * represents the size of the approaching finger or tool used to make contact.
494      * - For a touch pad, reports the length of the minor axis of an ellipse that
495      * represents the size of the approaching finger or tool used to make contact.
496      * The units are device-dependent.
497      *
498      * When the touch is circular, the major and minor axis lengths will be equal to one another.
499      *
500      * The tool size may be larger than the touch size since the tool may not be fully
501      * in contact with the touch sensor.
502      */
503     AMOTION_EVENT_AXIS_TOOL_MINOR = 7,
504     /**
505      * Axis constant: Orientation axis of a motion event.
506      *
507      * - For a touch screen or touch pad, reports the orientation of the finger
508      * or tool in radians relative to the vertical plane of the device.
509      * An angle of 0 radians indicates that the major axis of contact is oriented
510      * upwards, is perfectly circular or is of unknown orientation.  A positive angle
511      * indicates that the major axis of contact is oriented to the right.  A negative angle
512      * indicates that the major axis of contact is oriented to the left.
513      * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
514      * (finger pointing fully right).
515      * - For a stylus, the orientation indicates the direction in which the stylus
516      * is pointing in relation to the vertical axis of the current orientation of the screen.
517      * The range is from -PI radians to PI radians, where 0 is pointing up,
518      * -PI/2 radians is pointing left, -PI or PI radians is pointing down, and PI/2 radians
519      * is pointing right.  See also {@link AMOTION_EVENT_AXIS_TILT}.
520      */
521     AMOTION_EVENT_AXIS_ORIENTATION = 8,
522     /**
523      * Axis constant: Vertical Scroll axis of a motion event.
524      *
525      * - For a mouse, reports the relative movement of the vertical scroll wheel.
526      * The value is normalized to a range from -1.0 (down) to 1.0 (up).
527      *
528      * This axis should be used to scroll views vertically.
529      */
530     AMOTION_EVENT_AXIS_VSCROLL = 9,
531     /**
532      * Axis constant: Horizontal Scroll axis of a motion event.
533      *
534      * - For a mouse, reports the relative movement of the horizontal scroll wheel.
535      * The value is normalized to a range from -1.0 (left) to 1.0 (right).
536      *
537      * This axis should be used to scroll views horizontally.
538      */
539     AMOTION_EVENT_AXIS_HSCROLL = 10,
540     /**
541      * Axis constant: Z axis of a motion event.
542      *
543      * - For a joystick, reports the absolute Z position of the joystick.
544      * The value is normalized to a range from -1.0 (high) to 1.0 (low).
545      * <em>On game pads with two analog joysticks, this axis is often reinterpreted
546      * to report the absolute X position of the second joystick instead.</em>
547      */
548     AMOTION_EVENT_AXIS_Z = 11,
549     /**
550      * Axis constant: X Rotation axis of a motion event.
551      *
552      * - For a joystick, reports the absolute rotation angle about the X axis.
553      * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
554      */
555     AMOTION_EVENT_AXIS_RX = 12,
556     /**
557      * Axis constant: Y Rotation axis of a motion event.
558      *
559      * - For a joystick, reports the absolute rotation angle about the Y axis.
560      * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
561      */
562     AMOTION_EVENT_AXIS_RY = 13,
563     /**
564      * Axis constant: Z Rotation axis of a motion event.
565      *
566      * - For a joystick, reports the absolute rotation angle about the Z axis.
567      * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
568      * On game pads with two analog joysticks, this axis is often reinterpreted
569      * to report the absolute Y position of the second joystick instead.
570      */
571     AMOTION_EVENT_AXIS_RZ = 14,
572     /**
573      * Axis constant: Hat X axis of a motion event.
574      *
575      * - For a joystick, reports the absolute X position of the directional hat control.
576      * The value is normalized to a range from -1.0 (left) to 1.0 (right).
577      */
578     AMOTION_EVENT_AXIS_HAT_X = 15,
579     /**
580      * Axis constant: Hat Y axis of a motion event.
581      *
582      * - For a joystick, reports the absolute Y position of the directional hat control.
583      * The value is normalized to a range from -1.0 (up) to 1.0 (down).
584      */
585     AMOTION_EVENT_AXIS_HAT_Y = 16,
586     /**
587      * Axis constant: Left Trigger axis of a motion event.
588      *
589      * - For a joystick, reports the absolute position of the left trigger control.
590      * The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed).
591      */
592     AMOTION_EVENT_AXIS_LTRIGGER = 17,
593     /**
594      * Axis constant: Right Trigger axis of a motion event.
595      *
596      * - For a joystick, reports the absolute position of the right trigger control.
597      * The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed).
598      */
599     AMOTION_EVENT_AXIS_RTRIGGER = 18,
600     /**
601      * Axis constant: Throttle axis of a motion event.
602      *
603      * - For a joystick, reports the absolute position of the throttle control.
604      * The value is normalized to a range from 0.0 (fully open) to 1.0 (fully closed).
605      */
606     AMOTION_EVENT_AXIS_THROTTLE = 19,
607     /**
608      * Axis constant: Rudder axis of a motion event.
609      *
610      * - For a joystick, reports the absolute position of the rudder control.
611      * The value is normalized to a range from -1.0 (turn left) to 1.0 (turn right).
612      */
613     AMOTION_EVENT_AXIS_RUDDER = 20,
614     /**
615      * Axis constant: Wheel axis of a motion event.
616      *
617      * - For a joystick, reports the absolute position of the steering wheel control.
618      * The value is normalized to a range from -1.0 (turn left) to 1.0 (turn right).
619      */
620     AMOTION_EVENT_AXIS_WHEEL = 21,
621     /**
622      * Axis constant: Gas axis of a motion event.
623      *
624      * - For a joystick, reports the absolute position of the gas (accelerator) control.
625      * The value is normalized to a range from 0.0 (no acceleration)
626      * to 1.0 (maximum acceleration).
627      */
628     AMOTION_EVENT_AXIS_GAS = 22,
629     /**
630      * Axis constant: Brake axis of a motion event.
631      *
632      * - For a joystick, reports the absolute position of the brake control.
633      * The value is normalized to a range from 0.0 (no braking) to 1.0 (maximum braking).
634      */
635     AMOTION_EVENT_AXIS_BRAKE = 23,
636     /**
637      * Axis constant: Distance axis of a motion event.
638      *
639      * - For a stylus, reports the distance of the stylus from the screen.
640      * A value of 0.0 indicates direct contact and larger values indicate increasing
641      * distance from the surface.
642      */
643     AMOTION_EVENT_AXIS_DISTANCE = 24,
644     /**
645      * Axis constant: Tilt axis of a motion event.
646      *
647      * - For a stylus, reports the tilt angle of the stylus in radians where
648      * 0 radians indicates that the stylus is being held perpendicular to the
649      * surface, and PI/2 radians indicates that the stylus is being held flat
650      * against the surface.
651      */
652     AMOTION_EVENT_AXIS_TILT = 25,
653     /**
654      * Axis constant:  Generic scroll axis of a motion event.
655      *
656      * - This is used for scroll axis motion events that can't be classified as strictly
657      *   vertical or horizontal. The movement of a rotating scroller is an example of this.
658      */
659     AMOTION_EVENT_AXIS_SCROLL = 26,
660     /**
661      * Axis constant: The movement of x position of a motion event.
662      *
663      * - For a mouse, reports a difference of x position between the previous position.
664      * This is useful when pointer is captured, in that case the mouse pointer doesn't
665      * change the location but this axis reports the difference which allows the app
666      * to see how the mouse is moved.
667      */
668     AMOTION_EVENT_AXIS_RELATIVE_X = 27,
669     /**
670      * Axis constant: The movement of y position of a motion event.
671      *
672      * Same as {@link RELATIVE_X}, but for y position.
673      */
674     AMOTION_EVENT_AXIS_RELATIVE_Y = 28,
675     /**
676      * Axis constant: Generic 1 axis of a motion event.
677      * The interpretation of a generic axis is device-specific.
678      */
679     AMOTION_EVENT_AXIS_GENERIC_1 = 32,
680     /**
681      * Axis constant: Generic 2 axis of a motion event.
682      * The interpretation of a generic axis is device-specific.
683      */
684     AMOTION_EVENT_AXIS_GENERIC_2 = 33,
685     /**
686      * Axis constant: Generic 3 axis of a motion event.
687      * The interpretation of a generic axis is device-specific.
688      */
689     AMOTION_EVENT_AXIS_GENERIC_3 = 34,
690     /**
691      * Axis constant: Generic 4 axis of a motion event.
692      * The interpretation of a generic axis is device-specific.
693      */
694     AMOTION_EVENT_AXIS_GENERIC_4 = 35,
695     /**
696      * Axis constant: Generic 5 axis of a motion event.
697      * The interpretation of a generic axis is device-specific.
698      */
699     AMOTION_EVENT_AXIS_GENERIC_5 = 36,
700     /**
701      * Axis constant: Generic 6 axis of a motion event.
702      * The interpretation of a generic axis is device-specific.
703      */
704     AMOTION_EVENT_AXIS_GENERIC_6 = 37,
705     /**
706      * Axis constant: Generic 7 axis of a motion event.
707      * The interpretation of a generic axis is device-specific.
708      */
709     AMOTION_EVENT_AXIS_GENERIC_7 = 38,
710     /**
711      * Axis constant: Generic 8 axis of a motion event.
712      * The interpretation of a generic axis is device-specific.
713      */
714     AMOTION_EVENT_AXIS_GENERIC_8 = 39,
715     /**
716      * Axis constant: Generic 9 axis of a motion event.
717      * The interpretation of a generic axis is device-specific.
718      */
719     AMOTION_EVENT_AXIS_GENERIC_9 = 40,
720     /**
721      * Axis constant: Generic 10 axis of a motion event.
722      * The interpretation of a generic axis is device-specific.
723      */
724     AMOTION_EVENT_AXIS_GENERIC_10 = 41,
725     /**
726      * Axis constant: Generic 11 axis of a motion event.
727      * The interpretation of a generic axis is device-specific.
728      */
729     AMOTION_EVENT_AXIS_GENERIC_11 = 42,
730     /**
731      * Axis constant: Generic 12 axis of a motion event.
732      * The interpretation of a generic axis is device-specific.
733      */
734     AMOTION_EVENT_AXIS_GENERIC_12 = 43,
735     /**
736      * Axis constant: Generic 13 axis of a motion event.
737      * The interpretation of a generic axis is device-specific.
738      */
739     AMOTION_EVENT_AXIS_GENERIC_13 = 44,
740     /**
741      * Axis constant: Generic 14 axis of a motion event.
742      * The interpretation of a generic axis is device-specific.
743      */
744     AMOTION_EVENT_AXIS_GENERIC_14 = 45,
745     /**
746      * Axis constant: Generic 15 axis of a motion event.
747      * The interpretation of a generic axis is device-specific.
748      */
749     AMOTION_EVENT_AXIS_GENERIC_15 = 46,
750     /**
751      * Axis constant: Generic 16 axis of a motion event.
752      * The interpretation of a generic axis is device-specific.
753      */
754     AMOTION_EVENT_AXIS_GENERIC_16 = 47
755 
756     // NOTE: If you add a new axis here you must also add it to several other files.
757     //       Refer to frameworks/base/core/java/android/view/MotionEvent.java for the full list.
758 }
759 
760 /**
761  * Constants that identify buttons that are associated with motion events.
762  * Refer to the documentation on the MotionEvent class for descriptions of each button.
763  */
764 enum
765 {
766     /** primary */
767     AMOTION_EVENT_BUTTON_PRIMARY = 1 << 0,
768     /** secondary */
769     AMOTION_EVENT_BUTTON_SECONDARY = 1 << 1,
770     /** tertiary */
771     AMOTION_EVENT_BUTTON_TERTIARY = 1 << 2,
772     /** back */
773     AMOTION_EVENT_BUTTON_BACK = 1 << 3,
774     /** forward */
775     AMOTION_EVENT_BUTTON_FORWARD = 1 << 4,
776     AMOTION_EVENT_BUTTON_STYLUS_PRIMARY = 1 << 5,
777     AMOTION_EVENT_BUTTON_STYLUS_SECONDARY = 1 << 6
778 }
779 
780 /**
781  * Constants that identify tool types.
782  * Refer to the documentation on the MotionEvent class for descriptions of each tool type.
783  */
784 enum
785 {
786     /** unknown */
787     AMOTION_EVENT_TOOL_TYPE_UNKNOWN = 0,
788     /** finger */
789     AMOTION_EVENT_TOOL_TYPE_FINGER = 1,
790     /** stylus */
791     AMOTION_EVENT_TOOL_TYPE_STYLUS = 2,
792     /** mouse */
793     AMOTION_EVENT_TOOL_TYPE_MOUSE = 3,
794     /** eraser */
795     AMOTION_EVENT_TOOL_TYPE_ERASER = 4
796 }
797 
798 /**
799  * Input source masks.
800  *
801  * Refer to the documentation on android.view.InputDevice for more details about input sources
802  * and their correct interpretation.
803  */
804 enum
805 {
806     /** mask */
807     AINPUT_SOURCE_CLASS_MASK = 0x000000ff,
808 
809     /** none */
810     AINPUT_SOURCE_CLASS_NONE = 0x00000000,
811     /** button */
812     AINPUT_SOURCE_CLASS_BUTTON = 0x00000001,
813     /** pointer */
814     AINPUT_SOURCE_CLASS_POINTER = 0x00000002,
815     /** navigation */
816     AINPUT_SOURCE_CLASS_NAVIGATION = 0x00000004,
817     /** position */
818     AINPUT_SOURCE_CLASS_POSITION = 0x00000008,
819     /** joystick */
820     AINPUT_SOURCE_CLASS_JOYSTICK = 0x00000010
821 }
822 
823 /**
824  * Input sources.
825  */
826 enum
827 {
828     /** unknown */
829     AINPUT_SOURCE_UNKNOWN = 0x00000000,
830 
831     /** keyboard */
832     AINPUT_SOURCE_KEYBOARD = 0x00000100 | .AINPUT_SOURCE_CLASS_BUTTON,
833     /** dpad */
834     AINPUT_SOURCE_DPAD = 0x00000200 | .AINPUT_SOURCE_CLASS_BUTTON,
835     /** gamepad */
836     AINPUT_SOURCE_GAMEPAD = 0x00000400 | .AINPUT_SOURCE_CLASS_BUTTON,
837     /** touchscreen */
838     AINPUT_SOURCE_TOUCHSCREEN = 0x00001000 | .AINPUT_SOURCE_CLASS_POINTER,
839     /** mouse */
840     AINPUT_SOURCE_MOUSE = 0x00002000 | .AINPUT_SOURCE_CLASS_POINTER,
841     /** stylus */
842     AINPUT_SOURCE_STYLUS = 0x00004000 | .AINPUT_SOURCE_CLASS_POINTER,
843     /** bluetooth stylus */
844     AINPUT_SOURCE_BLUETOOTH_STYLUS = 0x00008000 | AINPUT_SOURCE_STYLUS,
845     /** trackball */
846     AINPUT_SOURCE_TRACKBALL = 0x00010000 | .AINPUT_SOURCE_CLASS_NAVIGATION,
847     /** mouse relative */
848     AINPUT_SOURCE_MOUSE_RELATIVE = 0x00020000 | .AINPUT_SOURCE_CLASS_NAVIGATION,
849     /** touchpad */
850     AINPUT_SOURCE_TOUCHPAD = 0x00100000 | .AINPUT_SOURCE_CLASS_POSITION,
851     /** navigation */
852     AINPUT_SOURCE_TOUCH_NAVIGATION = 0x00200000 | .AINPUT_SOURCE_CLASS_NONE,
853     /** joystick */
854     AINPUT_SOURCE_JOYSTICK = 0x01000000 | .AINPUT_SOURCE_CLASS_JOYSTICK,
855     /** rotary encoder */
856     AINPUT_SOURCE_ROTARY_ENCODER = 0x00400000 | .AINPUT_SOURCE_CLASS_NONE,
857 
858     /** any */
859     AINPUT_SOURCE_ANY = 0xffffff00
860 }
861 
862 /**
863  * Keyboard types.
864  *
865  * Refer to the documentation on android.view.InputDevice for more details.
866  */
867 enum
868 {
869     /** none */
870     AINPUT_KEYBOARD_TYPE_NONE = 0,
871     /** non alphabetic */
872     AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC = 1,
873     /** alphabetic */
874     AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2
875 }
876 
877 /**
878  * Constants used to retrieve information about the range of motion for a particular
879  * coordinate of a motion event.
880  *
881  * Refer to the documentation on android.view.InputDevice for more details about input sources
882  * and their correct interpretation.
883  *
884  * @deprecated These constants are deprecated. Use {@link AMOTION_EVENT_AXIS AMOTION_EVENT_AXIS_*} constants instead.
885  */
886 enum
887 {
888     /** x */
889     AINPUT_MOTION_RANGE_X = .AMOTION_EVENT_AXIS_X,
890     /** y */
891     AINPUT_MOTION_RANGE_Y = .AMOTION_EVENT_AXIS_Y,
892     /** pressure */
893     AINPUT_MOTION_RANGE_PRESSURE = .AMOTION_EVENT_AXIS_PRESSURE,
894     /** size */
895     AINPUT_MOTION_RANGE_SIZE = .AMOTION_EVENT_AXIS_SIZE,
896     /** touch major */
897     AINPUT_MOTION_RANGE_TOUCH_MAJOR = .AMOTION_EVENT_AXIS_TOUCH_MAJOR,
898     /** touch minor */
899     AINPUT_MOTION_RANGE_TOUCH_MINOR = .AMOTION_EVENT_AXIS_TOUCH_MINOR,
900     /** tool major */
901     AINPUT_MOTION_RANGE_TOOL_MAJOR = .AMOTION_EVENT_AXIS_TOOL_MAJOR,
902     /** tool minor */
903     AINPUT_MOTION_RANGE_TOOL_MINOR = .AMOTION_EVENT_AXIS_TOOL_MINOR,
904     /** orientation */
905     AINPUT_MOTION_RANGE_ORIENTATION = .AMOTION_EVENT_AXIS_ORIENTATION
906 }
907 
908 /**
909  * Input event accessors.
910  *
911  * Note that most functions can only be used on input events that are of a given type.
912  * Calling these functions on input events of other types will yield undefined behavior.
913  */
914 
915 /*** Accessors for all input events. ***/
916 
917 /** Get the input event type. */
918 int AInputEvent_getType (const(AInputEvent)* event);
919 
920 /** Get the id for the device that an input event came from.
921  *
922  * Input events can be generated by multiple different input devices.
923  * Use the input device id to obtain information about the input
924  * device that was responsible for generating a particular event.
925  *
926  * An input device id of 0 indicates that the event didn't come from a physical device;
927  * other numbers are arbitrary and you shouldn't depend on the values.
928  * Use the provided input device query API to obtain information about input devices.
929  */
930 int AInputEvent_getDeviceId (const(AInputEvent)* event);
931 
932 /** Get the input event source. */
933 int AInputEvent_getSource (const(AInputEvent)* event);
934 
935 /*** Accessors for key events only. ***/
936 
937 /** Get the key event action. */
938 int AKeyEvent_getAction (const(AInputEvent)* key_event);
939 
940 /** Get the key event flags. */
941 int AKeyEvent_getFlags (const(AInputEvent)* key_event);
942 
943 /**
944  * Get the key code of the key event.
945  * This is the physical key that was pressed, not the Unicode character.
946  */
947 int AKeyEvent_getKeyCode (const(AInputEvent)* key_event);
948 
949 /**
950  * Get the hardware key id of this key event.
951  * These values are not reliable and vary from device to device.
952  */
953 int AKeyEvent_getScanCode (const(AInputEvent)* key_event);
954 
955 /** Get the meta key state. */
956 int AKeyEvent_getMetaState (const(AInputEvent)* key_event);
957 
958 /**
959  * Get the repeat count of the event.
960  * For both key up an key down events, this is the number of times the key has
961  * repeated with the first down starting at 0 and counting up from there.  For
962  * multiple key events, this is the number of down/up pairs that have occurred.
963  */
964 int AKeyEvent_getRepeatCount (const(AInputEvent)* key_event);
965 
966 /**
967  * Get the time of the most recent key down event, in the
968  * java.lang.System.nanoTime() time base.  If this is a down event,
969  * this will be the same as eventTime.
970  * Note that when chording keys, this value is the down time of the most recently
971  * pressed key, which may not be the same physical key of this event.
972  */
973 long AKeyEvent_getDownTime (const(AInputEvent)* key_event);
974 
975 /**
976  * Get the time this event occurred, in the
977  * java.lang.System.nanoTime() time base.
978  */
979 long AKeyEvent_getEventTime (const(AInputEvent)* key_event);
980 
981 /*** Accessors for motion events only. ***/
982 
983 /** Get the combined motion event action code and pointer index. */
984 int AMotionEvent_getAction (const(AInputEvent)* motion_event);
985 
986 /** Get the motion event flags. */
987 int AMotionEvent_getFlags (const(AInputEvent)* motion_event);
988 
989 /**
990  * Get the state of any meta / modifier keys that were in effect when the
991  * event was generated.
992  */
993 int AMotionEvent_getMetaState (const(AInputEvent)* motion_event);
994 
995 /** Get the button state of all buttons that are pressed. */
996 int AMotionEvent_getButtonState (const(AInputEvent)* motion_event);
997 
998 /**
999  * Get a bitfield indicating which edges, if any, were touched by this motion event.
1000  * For touch events, clients can use this to determine if the user's finger was
1001  * touching the edge of the display.
1002  */
1003 int AMotionEvent_getEdgeFlags (const(AInputEvent)* motion_event);
1004 
1005 /**
1006  * Get the time when the user originally pressed down to start a stream of
1007  * position events, in the java.lang.System.nanoTime() time base.
1008  */
1009 long AMotionEvent_getDownTime (const(AInputEvent)* motion_event);
1010 
1011 /**
1012  * Get the time when this specific event was generated,
1013  * in the java.lang.System.nanoTime() time base.
1014  */
1015 long AMotionEvent_getEventTime (const(AInputEvent)* motion_event);
1016 
1017 /**
1018  * Get the X coordinate offset.
1019  * For touch events on the screen, this is the delta that was added to the raw
1020  * screen coordinates to adjust for the absolute position of the containing windows
1021  * and views.
1022  */
1023 float AMotionEvent_getXOffset (const(AInputEvent)* motion_event);
1024 
1025 /**
1026  * Get the Y coordinate offset.
1027  * For touch events on the screen, this is the delta that was added to the raw
1028  * screen coordinates to adjust for the absolute position of the containing windows
1029  * and views.
1030  */
1031 float AMotionEvent_getYOffset (const(AInputEvent)* motion_event);
1032 
1033 /**
1034  * Get the precision of the X coordinates being reported.
1035  * You can multiply this number with an X coordinate sample to find the
1036  * actual hardware value of the X coordinate.
1037  */
1038 float AMotionEvent_getXPrecision (const(AInputEvent)* motion_event);
1039 
1040 /**
1041  * Get the precision of the Y coordinates being reported.
1042  * You can multiply this number with a Y coordinate sample to find the
1043  * actual hardware value of the Y coordinate.
1044  */
1045 float AMotionEvent_getYPrecision (const(AInputEvent)* motion_event);
1046 
1047 /**
1048  * Get the number of pointers of data contained in this event.
1049  * Always >= 1.
1050  */
1051 size_t AMotionEvent_getPointerCount (const(AInputEvent)* motion_event);
1052 
1053 /**
1054  * Get the pointer identifier associated with a particular pointer
1055  * data index in this event.  The identifier tells you the actual pointer
1056  * number associated with the data, accounting for individual pointers
1057  * going up and down since the start of the current gesture.
1058  */
1059 int AMotionEvent_getPointerId (const(AInputEvent)* motion_event, size_t pointer_index);
1060 
1061 /**
1062  * Get the tool type of a pointer for the given pointer index.
1063  * The tool type indicates the type of tool used to make contact such as a
1064  * finger or stylus, if known.
1065  */
1066 int AMotionEvent_getToolType (const(AInputEvent)* motion_event, size_t pointer_index);
1067 
1068 /**
1069  * Get the original raw X coordinate of this event.
1070  * For touch events on the screen, this is the original location of the event
1071  * on the screen, before it had been adjusted for the containing window
1072  * and views.
1073  */
1074 float AMotionEvent_getRawX (const(AInputEvent)* motion_event, size_t pointer_index);
1075 
1076 /**
1077  * Get the original raw X coordinate of this event.
1078  * For touch events on the screen, this is the original location of the event
1079  * on the screen, before it had been adjusted for the containing window
1080  * and views.
1081  */
1082 float AMotionEvent_getRawY (const(AInputEvent)* motion_event, size_t pointer_index);
1083 
1084 /**
1085  * Get the current X coordinate of this event for the given pointer index.
1086  * Whole numbers are pixels; the value may have a fraction for input devices
1087  * that are sub-pixel precise.
1088  */
1089 float AMotionEvent_getX (const(AInputEvent)* motion_event, size_t pointer_index);
1090 
1091 /**
1092  * Get the current Y coordinate of this event for the given pointer index.
1093  * Whole numbers are pixels; the value may have a fraction for input devices
1094  * that are sub-pixel precise.
1095  */
1096 float AMotionEvent_getY (const(AInputEvent)* motion_event, size_t pointer_index);
1097 
1098 /**
1099  * Get the current pressure of this event for the given pointer index.
1100  * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
1101  * although values higher than 1 may be generated depending on the calibration of
1102  * the input device.
1103  */
1104 float AMotionEvent_getPressure (const(AInputEvent)* motion_event, size_t pointer_index);
1105 
1106 /**
1107  * Get the current scaled value of the approximate size for the given pointer index.
1108  * This represents some approximation of the area of the screen being
1109  * pressed; the actual value in pixels corresponding to the
1110  * touch is normalized with the device specific range of values
1111  * and scaled to a value between 0 and 1.  The value of size can be used to
1112  * determine fat touch events.
1113  */
1114 float AMotionEvent_getSize (const(AInputEvent)* motion_event, size_t pointer_index);
1115 
1116 /**
1117  * Get the current length of the major axis of an ellipse that describes the touch area
1118  * at the point of contact for the given pointer index.
1119  */
1120 float AMotionEvent_getTouchMajor (const(AInputEvent)* motion_event, size_t pointer_index);
1121 
1122 /**
1123  * Get the current length of the minor axis of an ellipse that describes the touch area
1124  * at the point of contact for the given pointer index.
1125  */
1126 float AMotionEvent_getTouchMinor (const(AInputEvent)* motion_event, size_t pointer_index);
1127 
1128 /**
1129  * Get the current length of the major axis of an ellipse that describes the size
1130  * of the approaching tool for the given pointer index.
1131  * The tool area represents the estimated size of the finger or pen that is
1132  * touching the device independent of its actual touch area at the point of contact.
1133  */
1134 float AMotionEvent_getToolMajor (const(AInputEvent)* motion_event, size_t pointer_index);
1135 
1136 /**
1137  * Get the current length of the minor axis of an ellipse that describes the size
1138  * of the approaching tool for the given pointer index.
1139  * The tool area represents the estimated size of the finger or pen that is
1140  * touching the device independent of its actual touch area at the point of contact.
1141  */
1142 float AMotionEvent_getToolMinor (const(AInputEvent)* motion_event, size_t pointer_index);
1143 
1144 /**
1145  * Get the current orientation of the touch area and tool area in radians clockwise from
1146  * vertical for the given pointer index.
1147  * An angle of 0 degrees indicates that the major axis of contact is oriented
1148  * upwards, is perfectly circular or is of unknown orientation.  A positive angle
1149  * indicates that the major axis of contact is oriented to the right.  A negative angle
1150  * indicates that the major axis of contact is oriented to the left.
1151  * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
1152  * (finger pointing fully right).
1153  */
1154 float AMotionEvent_getOrientation (const(AInputEvent)* motion_event, size_t pointer_index);
1155 
1156 /** Get the value of the request axis for the given pointer index. */
1157 float AMotionEvent_getAxisValue (
1158     const(AInputEvent)* motion_event,
1159     int axis,
1160     size_t pointer_index);
1161 
1162 /**
1163  * Get the number of historical points in this event.  These are movements that
1164  * have occurred between this event and the previous event.  This only applies
1165  * to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0.
1166  * Historical samples are indexed from oldest to newest.
1167  */
1168 size_t AMotionEvent_getHistorySize (const(AInputEvent)* motion_event);
1169 
1170 /**
1171  * Get the time that a historical movement occurred between this event and
1172  * the previous event, in the java.lang.System.nanoTime() time base.
1173  */
1174 long AMotionEvent_getHistoricalEventTime (
1175     const(AInputEvent)* motion_event,
1176     size_t history_index);
1177 
1178 /**
1179  * Get the historical raw X coordinate of this event for the given pointer index that
1180  * occurred between this event and the previous motion event.
1181  * For touch events on the screen, this is the original location of the event
1182  * on the screen, before it had been adjusted for the containing window
1183  * and views.
1184  * Whole numbers are pixels; the value may have a fraction for input devices
1185  * that are sub-pixel precise.
1186  */
1187 float AMotionEvent_getHistoricalRawX (
1188     const(AInputEvent)* motion_event,
1189     size_t pointer_index,
1190     size_t history_index);
1191 
1192 /**
1193  * Get the historical raw Y coordinate of this event for the given pointer index that
1194  * occurred between this event and the previous motion event.
1195  * For touch events on the screen, this is the original location of the event
1196  * on the screen, before it had been adjusted for the containing window
1197  * and views.
1198  * Whole numbers are pixels; the value may have a fraction for input devices
1199  * that are sub-pixel precise.
1200  */
1201 float AMotionEvent_getHistoricalRawY (
1202     const(AInputEvent)* motion_event,
1203     size_t pointer_index,
1204     size_t history_index);
1205 
1206 /**
1207  * Get the historical X coordinate of this event for the given pointer index that
1208  * occurred between this event and the previous motion event.
1209  * Whole numbers are pixels; the value may have a fraction for input devices
1210  * that are sub-pixel precise.
1211  */
1212 float AMotionEvent_getHistoricalX (
1213     const(AInputEvent)* motion_event,
1214     size_t pointer_index,
1215     size_t history_index);
1216 
1217 /**
1218  * Get the historical Y coordinate of this event for the given pointer index that
1219  * occurred between this event and the previous motion event.
1220  * Whole numbers are pixels; the value may have a fraction for input devices
1221  * that are sub-pixel precise.
1222  */
1223 float AMotionEvent_getHistoricalY (
1224     const(AInputEvent)* motion_event,
1225     size_t pointer_index,
1226     size_t history_index);
1227 
1228 /**
1229  * Get the historical pressure of this event for the given pointer index that
1230  * occurred between this event and the previous motion event.
1231  * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
1232  * although values higher than 1 may be generated depending on the calibration of
1233  * the input device.
1234  */
1235 float AMotionEvent_getHistoricalPressure (
1236     const(AInputEvent)* motion_event,
1237     size_t pointer_index,
1238     size_t history_index);
1239 
1240 /**
1241  * Get the current scaled value of the approximate size for the given pointer index that
1242  * occurred between this event and the previous motion event.
1243  * This represents some approximation of the area of the screen being
1244  * pressed; the actual value in pixels corresponding to the
1245  * touch is normalized with the device specific range of values
1246  * and scaled to a value between 0 and 1.  The value of size can be used to
1247  * determine fat touch events.
1248  */
1249 float AMotionEvent_getHistoricalSize (
1250     const(AInputEvent)* motion_event,
1251     size_t pointer_index,
1252     size_t history_index);
1253 
1254 /**
1255  * Get the historical length of the major axis of an ellipse that describes the touch area
1256  * at the point of contact for the given pointer index that
1257  * occurred between this event and the previous motion event.
1258  */
1259 float AMotionEvent_getHistoricalTouchMajor (
1260     const(AInputEvent)* motion_event,
1261     size_t pointer_index,
1262     size_t history_index);
1263 
1264 /**
1265  * Get the historical length of the minor axis of an ellipse that describes the touch area
1266  * at the point of contact for the given pointer index that
1267  * occurred between this event and the previous motion event.
1268  */
1269 float AMotionEvent_getHistoricalTouchMinor (
1270     const(AInputEvent)* motion_event,
1271     size_t pointer_index,
1272     size_t history_index);
1273 
1274 /**
1275  * Get the historical length of the major axis of an ellipse that describes the size
1276  * of the approaching tool for the given pointer index that
1277  * occurred between this event and the previous motion event.
1278  * The tool area represents the estimated size of the finger or pen that is
1279  * touching the device independent of its actual touch area at the point of contact.
1280  */
1281 float AMotionEvent_getHistoricalToolMajor (
1282     const(AInputEvent)* motion_event,
1283     size_t pointer_index,
1284     size_t history_index);
1285 
1286 /**
1287  * Get the historical length of the minor axis of an ellipse that describes the size
1288  * of the approaching tool for the given pointer index that
1289  * occurred between this event and the previous motion event.
1290  * The tool area represents the estimated size of the finger or pen that is
1291  * touching the device independent of its actual touch area at the point of contact.
1292  */
1293 float AMotionEvent_getHistoricalToolMinor (
1294     const(AInputEvent)* motion_event,
1295     size_t pointer_index,
1296     size_t history_index);
1297 
1298 /**
1299  * Get the historical orientation of the touch area and tool area in radians clockwise from
1300  * vertical for the given pointer index that
1301  * occurred between this event and the previous motion event.
1302  * An angle of 0 degrees indicates that the major axis of contact is oriented
1303  * upwards, is perfectly circular or is of unknown orientation.  A positive angle
1304  * indicates that the major axis of contact is oriented to the right.  A negative angle
1305  * indicates that the major axis of contact is oriented to the left.
1306  * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
1307  * (finger pointing fully right).
1308  */
1309 float AMotionEvent_getHistoricalOrientation (
1310     const(AInputEvent)* motion_event,
1311     size_t pointer_index,
1312     size_t history_index);
1313 
1314 /**
1315  * Get the historical value of the request axis for the given pointer index
1316  * that occurred between this event and the previous motion event.
1317  */
1318 float AMotionEvent_getHistoricalAxisValue (
1319     const(AInputEvent)* motion_event,
1320     int axis,
1321     size_t pointer_index,
1322     size_t history_index);
1323 
1324 struct AInputQueue;
1325 /**
1326  * Input queue
1327  *
1328  * An input queue is the facility through which you retrieve input
1329  * events.
1330  */
1331 
1332 /**
1333  * Add this input queue to a looper for processing.  See
1334  * ALooper_addFd() for information on the ident, callback, and data params.
1335  */
1336 void AInputQueue_attachLooper (
1337     AInputQueue* queue,
1338     ALooper* looper,
1339     int ident,
1340     ALooper_callbackFunc callback,
1341     void* data);
1342 
1343 /**
1344  * Remove the input queue from the looper it is currently attached to.
1345  */
1346 void AInputQueue_detachLooper (AInputQueue* queue);
1347 
1348 /**
1349  * Returns true if there are one or more events available in the
1350  * input queue.  Returns 1 if the queue has events; 0 if
1351  * it does not have events; and a negative value if there is an error.
1352  */
1353 int AInputQueue_hasEvents (AInputQueue* queue);
1354 
1355 /**
1356  * Returns the next available event from the queue.  Returns a negative
1357  * value if no events are available or an error has occurred.
1358  */
1359 int AInputQueue_getEvent (AInputQueue* queue, AInputEvent** outEvent);
1360 
1361 /**
1362  * Sends the key for standard pre-dispatching -- that is, possibly deliver
1363  * it to the current IME to be consumed before the app.  Returns 0 if it
1364  * was not pre-dispatched, meaning you can process it right now.  If non-zero
1365  * is returned, you must abandon the current event processing and allow the
1366  * event to appear again in the event queue (if it does not get consumed during
1367  * pre-dispatching).
1368  */
1369 int AInputQueue_preDispatchEvent (AInputQueue* queue, AInputEvent* event);
1370 
1371 /**
1372  * Report that dispatching has finished with the given event.
1373  * This must be called after receiving an event with AInputQueue_get_event().
1374  */
1375 void AInputQueue_finishEvent (AInputQueue* queue, AInputEvent* event, int handled);
1376 
1377 // _ANDROID_INPUT_H
1378 
1379 /** @} */